package com.zhiwen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhiwen.domain.entity.SearchKeyword;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 搜索关键词Mapper接口
 */
@Mapper
public interface SearchKeywordMapper extends BaseMapper<SearchKeyword> {

    /**
     * 增加关键词搜索次数
     * @param keyword 关键词
     * @return 影响行数
     */
    @Update("UPDATE t_search_keyword SET count = count + 1, update_time = NOW() WHERE keyword = #{keyword}")
    int incrementCount(@Param("keyword") String keyword);
}
